<?php

 abstract class Controller_Base_Admin extends Controller_Base {

	protected $admin;
	protected $template;
	
	
	function __construct($admin = null) {
		parent::__construct();
		$this->admin	= new Model_Admin_User();
		$this->tabs		= new Model_Tabs();
		
		$this->template = new Template(site_path.'tmpl/admin/index.tmpl');

		if(!$this->admin->is_logged())
			throw new ControllerException ('not_logged_admin');

		if($this->admin) {
	
		    $this->template->setArgs(array(
		    	menu       => $this->menu->getHierarchicalMenu(array(uid => $this->admin->id)),
	    		'_user'	   => $this->admin,
	    		plugin_path=> COREPATH,
	    	));
		}		


    }
	
    function checkAccess() {

//error_log(" checkAccess  (".$this->id.")");
		if(!$this->admin->checkAccess($this->id))
			throw new ControllerException ('access_denied');
		
	}

 }
?>
